<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" session="false" %>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 
  - Author(s): yangjk
  - Date: 2014-10-28 15:03:35
  - Description:
-->
<head>
	<%@include file="/common.jsp"%>
	<%@include file="/common/common.jsp"%>
	<%@include file="/coframe/tools/skins/common.jsp" %>
	<title>首页</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
	<div style="width:100%;height:95%">
		<div style="float:left; width:100%; height:100%">
			<fieldset style="height:99%">
			<legend><strong>待办</strong></legend>
			<div class="nui-fit">
				<div id="tabs1" class="nui-tabs" activeIndex="0" style="width:100%;height:100%;" plain="true">
				      <div name="dbtab" title="待办" style="width:100%;height:100%;">
					        <div class="nui-fit"> 
					        <div id="dbtab" class="nui-datagrid" style="width:100%;height:100%;" 
					       		 url="com.atozsoft.wf.processOperate.queryMyProcessList.biz.ext"  dataField="processList" sortMode="client" pageSize="20" >
							    <div property="columns">
							    	<div type="indexcolumn" align="center" headerAlign="center">序号</div>
					                <div field="PROCESSINSTNAME" headerAlign="center" allowSort="true" renderer="Itemclick" width="200px">
					                	摘要
					                </div>
					                <div field="WORKITEMNAME" headerAlign="center" allowSort="true" width="150px">
					                	任务节点
					                </div>
					                <div field="STARTTIME_TO" headerAlign="center" align="center" allowSort="true" dateFormat="yyyy-MM-dd HH:mm:ss">
					                	任务到达时间
					                </div>
					                <div field="stopTime" headerAlign="center" allowSort="true" renderer="itname" width="100px">
					               		任务滞留时间
					                </div>
					                <div field="CREATERNAME" headerAlign="center" allowSort="true" width="100px">
					                	申请人
					                </div>
					                <div field="LASTNAME" headerAlign="center" allowSort="true" width="100px">
					                	上一节点审批人
					                </div>
					                <div field="ACTIVITYDEFID" visible="false">流程节点定义ID</div>
					                <!-- <div field="CREATETIME_TO" headerAlign="center" align="center" allowSort="true" dateFormat="yyyy-MM-dd HH:mm:ss">
					               		流程产生时间
					                </div> -->
					                <!-- <div field="PROCESSCHNAME" headerAlign="center" allowSort="true" width="150px">
					                	任务名称
					                </div> -->
					                <!-- <div field="ACTIVITYINSTNAME" headerAlign="center" visible="false" allowSort="true" width="150px">
					                	
					                </div> -->
							    </div>
							</div>
						 </div>    
					</div>  
					<div name="ybtab" title="已办" style="width:100%;height:100%;"  >
				        <div class="mini-fit"> 
				           <div id="ybtab" class="nui-datagrid" style="width:100%;height:100%;" 
					       		 url="com.atozsoft.wf.processOperate.queryMyProcessYBList.biz.ext"  dataField="processList" sortMode="client" pageSize="20" >
							    <div property="columns">
							    	<div type="indexcolumn" align="center" headerAlign="center">序号</div>
					                <div field="PROCESSINSTNAME" headerAlign="center" renderer="Itemclickread" width="200px">
					                	摘要
					                </div>
					                <div field="WORKITEMNAME" headerAlign="center" width="150px">
					                	任务节点
					                </div>
					                <div field="APPROVEDATE"  headerAlign="center" align="center" dateFormat="yyyy-MM-dd HH:mm:ss">
					                	处理时间
					                </div>
					                <div field="PCREATORNAME" headerAlign="center" allowSort="true" width="100px">
					                	申请人
					                </div>
					                <!--  <div field="PCREATETIME" headerAlign="center" align="center" allowSort="true" dateFormat="yyyy-MM-dd HH:mm:ss">
					               		流程产生时间
					                </div>
					                <div field="STARTTIME" headerAlign="center" align="center" allowSort="true" dateFormat="yyyy-MM-dd HH:mm:ss">
					                	任务到达时间
					                </div>
					                <div field="stopTimeYB" headerAlign="center" allowSort="true" width="70px" renderer="itname">
					               		任务滞留时间
					                </div> -->
					                <!-- <div field="ACTIVITYINSTNAME" headerAlign="center" visible="false" allowSort="true" width="150px">
					                	
					                </div> -->
							    </div>
							</div>
						</div>    
					</div> 
				 </div> 
			</div>
			</fieldset>
		</div>
	</div>
	<script type="text/javascript">
		// 一览行数据字典显示相关
		function itname(e){
    		// 滞留时间计算
    		if(e.field=="stopTime"){
				var endTime = new Date();
				var startTime = new Date(e.row.STARTTIME_TO);
				var days = (endTime.getTime() - startTime.getTime()) / (1000 * 60 * 60 * 24);
				return Math.round(days*10)/10+"天";
			}
		}
   	</script>
	<script type="text/javascript">
	    nui.parse();
	    
	    var dbtab = nui.get("dbtab");//待办
	    var dataN = {currentstate:0};
    	//首次加载待办待阅消息datagrid数据
    	dbtab.load({map:dataN});
    	
    	var ybtab = nui.get("ybtab");//已办
    	var dataY = {currentstate:1};
    	ybtab.load({map:dataY});
        
    	// 项目名称链接
		function Itemclick(e){
	            <%-- var grid = e.sender;
	            var record = e.record;
	            var workitemid = record.WORKITEMID;
	            var processInstId = record.PROCESSINSTID; 
	            var executeType = record.EXECUTETYPE; //用来标识是否为转发或者抄送
	            var castatus = record.CASTATUS;  //用来标识是否为加审
	            var dataType = ""; //判断数据类型是转发、加审
	            if("1" != executeType) {
	              dataType = record.AGENTFROM?record.AGENTFROM:"<%=userId %>"; //委托人
	            }
	            //页面操作按钮加载(加载状态分：webType  阅读：read；操作：operate；已完成：done)
	            var url = "<%=request.getContextPath()%>/wf/processOperate/process_Detail.jsp?webType=operate&workitemid=" + workitemid +"&processInstId=" + processInstId+"&dataType=" + dataType+"&fromWeb=processlist";
				var name = record.PROCESSINSTNAME;
				var showName = record.PROCESSCHNAME;
	            var s = '<a class="New_Button"  style="color:#00C" href="javascript:addtab(\''+url+'\',\''+showName+'\')">'+name+'</a>';                       
	            return s; --%>
	    	var record = e.record;
	        var workitemid = record.WORKITEMID;
	        var processInstId = record.PROCESSINSTID; 
	        var activitydefid = record.ACTIVITYDEFID; //节点名字
	        var executeType = record.EXECUTETYPE; //用来标识是否为转发或者抄送
	        var castatus = record.CASTATUS;  //用来标识是否为加审
	        var id = record.KEYVALUE;
	        var dataType = ""; //判断数据类型是转发、加审
	        if("1" == executeType) {
	          dataType = "forward-" + record.TRANSMITID +"-"+ record.PCTCREATER; //数据是转发
	        }else if(castatus != null){   
	          dataType = "addApprove-" + record.ADDAPPROVEID +"-"+ record.CACREATER; //数据是加审  
	        }
	        //页面操作按钮加载(加载状态分：webType  阅读：read；操作：operate；已完成：done)
	        var url = "<%=request.getContextPath()%>/wf/processOperate/process_Detail.jsp?webType=operate&workitemid=" + workitemid +"&processInstId=" + processInstId+"&keyvalue="+id+"&dataType=" + dataType+"&activitydefid="+activitydefid;
			var name = record.PROCESSINSTNAME;
			var showName = record.PROCESSCHNAME;
	        var s = '<a class="New_Button"  style="color:#00C" href="javascript:addtab(\''+url+'\',\''+showName+'\')">'+name+'</a>';                       
	        return s;
		}
    	
		// 项目名称链接
		function Itemclickread(e){
            var grid = e.sender;
            var record = e.record;
            var workitemid = record.WORKITEMID;
            var processInstId = record.PROCESSINSTID; 
            var executeType = record.EXECUTETYPE; //用来标识是否为转发或者抄送
            var castatus = record.CASTATUS;  //用来标识是否为加审
            var id = record.KEYVALUE;
            var dataType = ""; //判断数据类型是转发、加审
            //页面操作按钮加载(加载状态分：webType  阅读：read；操作：operate；已完成：done)
            var done = "done";
            var url = "<%=request.getContextPath()%>/wf/processOperate/process_Detail.jsp?webType=done&workitemid=" + workitemid +"&processInstId=" + processInstId+"&fromWeb=processlist&keyvalue="+id+"&dataType=" + dataType;
			var name = record.PROCESSINSTNAME;
			var showName = record.PROCESSCHNAME;
            var s = '<a class="New_Button"  style="color:#00C" href="javascript:addtab(\''+url+'\',\''+showName+'\')">'+name+'</a>';                       
            return s;
		}
		
		// 跳转,新增tab页
		function addtab(url,name) {
			window.parent.parent.addtabs(url, "流程审批", "myProcess");
		}
      	
	</script>
	<script type="text/javascript">
		nui.parse();
	    
	    var dyNotcieGrid = nui.get("dyNotcieGrid");//待办
    	// 首次加载待办待阅消息datagrid数据
    	dyNotcieGrid.load();
    	
    	<%-- // 主题连接详情
    	function notciceClickRead(e){
    		var record = e.record;
    		if(record.REGISTER == 0){
	        	var url = "<%=request.getContextPath()%>/tb/internalRegister/internalRegister_detail.jsp?actionFlg=view&internalregistercode="+record.INTERNALREGISTERCODE;
	       	}else{
	       		var url = "<%=request.getContextPath()%>/tb/specialRegister/specialRegister_detail.jsp?actionFlg=view&specialregistercode="+record.INTERNALREGISTERCODE;
	       	}
			var name = record.PROJECTNAME;
			var showName = record.PROJECTNAME;
	        var s = '<a class="New_Button" style="color:#00C" href="javascript:addtab(\''+url+'\',\''+showName+'\')">'+name+'</a>';                       
	        return s;
	    } --%>
	    
	    // 主题连接详情
    	function notciceClickRead(e){
    		var record = e.record;
	        var url = "<%=request.getContextPath()%>/tb/systemMessage/noticeUser_view.jsp?noticeUserId="+record.NOTICEUSERID;
			var name = record.THEME;
			var showName = record.THEME;
	        var s = '<a class="New_Button" style="color:#00C" href="javascript:addpopup(\''+url+'\',\''+showName+'\')">'+name+'</a>';                       
	        return s;
	    }
	    
    	// 弹窗通知详情 
    	function addpopup(url,name) {
			nui.open({
                url: url,
                title: "通知详细信息",
                width: 650,
                height: 167,
                allowResize:false,
                onload: function () {
                },
                ondestroy: function (action) {
                	dyNotcieGrid.reload();
                }
            });
		}
	</script>
</body>
</html>